<%--
  Created by IntelliJ IDEA.
  User: Mr.G
  Date: 2019/1/11
  Time: 8:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form style="padding-top: 20px;" class="layui-form" >
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">药品名称：</label>
            <div class="layui-input-inline">
                <input type="text" id="ypname" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <button type="button" class="layui-btn layui-btn-sm" onclick="reloadData();"><i class="layui-icon layui-icon-search"></i> 搜索</button>
        </div>
    </div>
</form>
<table id="yptable" lay-lifter="yptable"></table>

<script>

    $("#ypname").on("keyup", function (e) {
        reloadData();
    });
    function reloadData(){
        layui.table.reload("yptable",{
            page:{
                curr : 1
            },
            where : {
                ypname : $("#ypname").val()
            }
        })
    }
    layui.use(['table','form','layedit'],function () {
        var table= layui.table;
        var form = layui.form;
        var layedit = layui.layedit;

        //渲染表格
        table.render({
            elem: '#yptable',
            url: '${path}/ypgl/list',
            page:true,
            even: true,
            cols:[[
                {type:'checkbox'},
                {field:'ypid',title:'标号'},
                {field:'ypname',title:'药品名称'},
                {field:'zyc',title:'制药厂'},
                {field:'ypdw',title:'药品单位',},
                {field:'ypshuoming',title:'药品说明'},
                {field:'yplsj',title:'药品零售价(元)'},

            ]]
        })
    })
</script>
</body>
</html>
